#!/usr/bin/perl
#
# prerm script for cclite
#
# see: dh_installdeb(1)

# summary of how this script can be called:
#        * <prerm> `remove'
#        * <old-prerm> `upgrade' <new-version>
#        * <new-prerm> `failed-upgrade' <old-version>
#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
#        * <deconfigured's-prerm> `deconfigure' `in-favour'
#          <package-being-installed> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package


$| = 1;

my $web_root     = '/var/www';
my $cclite_root  = '$web_root/cclite';


my $operation = $ARGV[0];


if ( $operation =~ /remove|deconfigure/ ) {

   `a2dissite cclite.private.server` ;
   `cp /etc/hosts.saved-by-cclite  /etc/hosts` ;    # restore old hosts
 #  `/etc/init.d/apache2 reload` ;
} else {

    print "prerm called with unknown argument \`$operation\'";
    exit 1;
}

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0;


